public class YahooSearch {
	public class YahooSearchException extends Exception {}
	
	public String title { get; set; }
	public String summary { get; set; }
	public String url { get; set; }
	public String clickUrl { get; set; }
	public String displayUrl { get; set; }
	public String modificationDate { get; set; }
	public String mimeType { get; set; }
     
    public YahooSearch(){}
     
    // Parse through the XML, deterimine the auther and the characters
	public YahooSearch(XmlStreamReader reader) {
	 	if('Result' != reader.getLocalName()) {
	 		throw new YahooSearchException('This constructor must have the current node of the XmlStreamReader set to "<Result>"');
	 	}
		// Go to first child of <Result>
		reader.next();	
					
		while(reader.hasNext()) {
			if (reader.getEventType() == XmlTag.START_ELEMENT) {
				System.debug(reader.getLocalName());
				if ('Title' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						title = reader.getText();
					}
				}
				else if ('Summary' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						summary = reader.getText();
					}
				}
				else if ('Url' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						url = reader.getText();
					}
				}
				else if ('ClickUrl' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						clickUrl = reader.getText();
					}
				}
				else if ('DisplayUrl' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						displayUrl = reader.getText();
					}
				}
				else if ('ModificationDate' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						modificationDate = reader.getText();
					}
				}
				else if ('MimeType' == reader.getLocalName()) {
					reader.next();
					if (reader.getEventType() == XmlTag.CHARACTERS) {
						mimeType = reader.getText();
					}
				}	
				else if ('Result' == reader.getLocalName()) {	
					// We're done with this result
					break;
				}								
			}
			reader.next();
		}
		System.debug('YahooSearch Result: ' +this);
	}     
}